package com.godyao.framework.beans.factory;

import com.godyao.framework.beans.factory.config.BeanPostProcessor;
import com.godyao.framework.beans.factory.factory.SingletonBeanRegistry;
import com.godyao.framework.utils.StringValueResolver;

/**
 * Configuration interface to be implemented by most bean factories. Provides
 * facilities to configure a bean factory, in addition to the bean factory
 * client methods in the {@link BeanFactory}
 * interface.
 */
public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, SingletonBeanRegistry {
    String SCOPE_SINGLETON = "singleton";

    String SCOPE_PROTOTYPE = "prototype";

    /**
     * 添加Bean后置处理器
     * @param beanPostProcessor
     */
    void addBeanPostProcessor(BeanPostProcessor beanPostProcessor);

    /**
     * 销毁单例对象 由它实现类AbstractBeanFactory的父类DefaultSingletonBeanRegistry实现
     */
    void destroySingletons();

    /**
     * 获取当前类加载器
     * @return
     */
    ClassLoader getBeanClassLoader();

    /**
     * 设置当前类加载器
     * @return
     */
    void setBeanClassLoader(ClassLoader classLoader);

    /**
     * Add a String resolver for embedded values such as annotation attributes.
     * @param valueResolver the String resolver to apply to embedded values
     * @since 3.0
     */
    void addEmbeddedValueResolver(StringValueResolver valueResolver);

    /**
     * Resolve the given embedded value, e.g. an annotation attribute.
     * @param value the value to resolve
     * @return the resolved value (may be the original value as-is)
     * @since 3.0
     */
    String resolveEmbeddedValue(String value);
}
